var mongoose = require("mongoose");
var settings = require('../settings');


var Student = mongoose.model('Student',{
	sid:{type:String,required:true,unique:true},
	name:String,
	password:String,
	Course:[{
		Course_id:{type:String,unique:true},
		Attendance:[{
				times:{type:Number,unique:true},
				here:Boolean
		}]
	}]
});



var Teacher = mongoose.model('Teacher',{
	tid:{type:String,unique:true,required:true},
	name:String,
	password:String,
	Course:[{Course_id:String}]
});

var Course = mongoose.model('Course',{
	cid:{type:String,unique:true,required:true},
	name:String,
	info:[{times:{type:Number,min:1,default:24},information:String}],
	time:[{
		wek:{type:Number,min:1,max:7},
		time_slot:{type:Number,min:1,max:6}
	}]
});



/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * this part depends on UI
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

var Personal_settings = mongoose.model('Personal',{
//Personal_settings
});

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

var Case_info = mongoose.model('Case_info',{
	title:{type:String,required:true},
	content:String,
	post_time:{
		year:{type:Number,min:2000,max:2100},
		month:{type:Number,min:1,max:12},
		day:{type:Number,min:1,max:31},
		hour:{type:Number,min:0,max:11},
		minute:{type:Number,min:0,max:59},
	},
	poster:String,
	reply:[{
		content:String,
		poster:{
			id:String
		},
		post_time:{
			year:{type:Number,min:2000,max:2100},
			month:{type:Number,min:1,max:12},
			day:{type:Number,min:1,max:31},
			hour:{type:Number,min:0,max:11},
			minute:{type:Number,min:0,max:59},
		}
	}]
});

var Learn_info = mongoose.model('Learn_info',{
	tag:{type:String},
	post_time:{
		year:{type:Number,min:2000,max:2100},
		month:{type:Number,min:1,max:12},
		day:{type:Number,min:1,max:31},
		hour:{type:Number,min:0,max:11},
		minute:{type:Number,min:0,max:59},
	},
	title:{type:String,unique:true,required:true},
	content:String
});

var Job_info = mongoose.model('Job_info',{
	post_time:{
		year:{type:Number,min:2000,max:2100},
		month:{type:Number,min:1,max:12},
		day:{type:Number,min:1,max:31},
		hour:{type:Number,min:0,max:11},
		minute:{type:Number,min:0,max:59},
	},
	title:{type:String,unique:true,required:true},
	content:String	
});

module.exports = {
	Student:Student,
	Teacher:Teacher,
	Course:Course,
// 	Personal_settings:Personal_settings,
//	Exam:Exam,
	Case_info:Case_info,
	Learn_info:Learn_info,
	Job_info:Job_info
	
};



